home *** CD-ROM | disk | FTP | other *** search
- unit IDERoller;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, IDEMouseWheel;
-
- implementation
-
- var
- Timer: UINT;
-
- procedure ScrollCodeEditor (Editor: TWinControl; Count: Integer);
- var
- Idx, Code: Integer;
- begin
- if Count < 0 then Code := sb_LineUp else Code := sb_LineDown;
- for Idx := 0 to Abs (Count) - 1 do SendMessage (Editor.Handle, wm_VScroll, Code, 0);
- end;
-
- procedure WheelSpin (Count: Integer);
- var
- Form: TForm;
- Editor: TWinControl;
- begin
- Form := Wheel.ActiveForm;
- { Sanity check time.... }
- if (Form <> Nil) and (Form.ClassName = 'TEditWindow') then begin
- Editor := TWinControl (Form.FindComponent ('Editor'));
- if Editor <> Nil then ScrollCodeEditor (Editor, Count);
- end;
- end;
-
- procedure TimerTick (Wnd: hWnd; Msg, Event, dwTime: UINT); stdcall;
- var
- Form: TForm;
- begin
- Form := Screen.ActiveForm;
- if (Form <> Nil) and (Form.ClassName = 'TEditWindow') then begin
- Wheel.ActiveForm := Form;
- Wheel.OnWheelSpin := WheelSpin;
- end
- else Wheel.ActiveForm := Nil;
- end;
-
- initialization
- if Wheel.WheelPresent then Timer := SetTimer (0, 0, 500, @TimerTick);
- finalization
- if Wheel.WheelPresent then begin
- Wheel.ActiveForm := Nil;
- KillTimer (0, Timer);
- end;
- end.
-